package cn.client.data.remoteData.repository

import cn.client.data.remoteData.ApiService
import cn.client.data.remoteData.bean.BaseResp
import cn.client.data.remoteData.bean.FriendCardItem
import cn.client.data.remoteData.bean.FriendInfo
import cn.client.data.remoteData.bean.ReceiveFriendApply
import cn.client.data.remoteData.bean.SearchFriend
import cn.client.data.remoteData.bean.SearchFriendRes
import cn.client.data.remoteData.bean.SendFriendApply
import cn.client.data.remoteData.bean.TakeFriendApply
import cn.client.data.remoteData.bean.UploadNickname
import javax.inject.Inject

class FriendRepository @Inject constructor(private val apiService: ApiService) {

    // 搜索用户
    suspend fun searchFriend(searchFriend: SearchFriend) : BaseResp<SearchFriendRes> {
        return apiService.searchFriend(searchFriend)
    }

    // 发送好友申请
    suspend fun sendFriendApply(sendFriendApply: SendFriendApply) : BaseResp<Any> {
        return apiService.sendFriendApply(sendFriendApply)
    }

    // 接收好友申请
    suspend fun receiveFriendApply(uid: Int) : BaseResp<List<ReceiveFriendApply>> {
        return apiService.receiveFriendApply(uid)
    }

    // 同意好友申请
    suspend fun agreeFriendApply(agreeFriendApply: TakeFriendApply) : BaseResp<Any> {
        return apiService.agreeFriendApply(agreeFriendApply)
    }

    // 忽略好友申请
    suspend fun ignoreFriendApply(ignoreFriendApply: TakeFriendApply) : BaseResp<Any> {
        return apiService.ignoreFriendApply(ignoreFriendApply)
    }

    // 好友列表
    suspend fun friendList(uid: Int) : BaseResp<List<FriendCardItem>> {
        return apiService.friendList(uid)
    }

    // 好友详情信息
    suspend fun friendInfo(fid: Int) : BaseResp<FriendInfo> {
        return apiService.friendInfo(fid)
    }

    // 修改好友昵称
    suspend fun updateNickname(uploadNickname: UploadNickname) : BaseResp<Any> {
        return apiService.updateNickname(uploadNickname)
    }

}